<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Jetson Inference: jetson-utils/cudaVector.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="NVLogo_2D.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Jetson Inference
   </div>
   <div id="projectbrief">DNN Vision Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('cudaVector_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">cudaVector.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="cudaVector_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * copy of this software and associated documentation files (the &quot;Software&quot;),</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * to deal in the Software without restriction, including without limitation</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * Software is furnished to do so, subject to the following conditions:</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * The above copyright notice and this permission notice shall be included in</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * all copies or substantial portions of the Software.</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * DEALINGS IN THE SOFTWARE.</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#ifndef __CUDA_VECTOR_TEMPLATES_H__</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#define __CUDA_VECTOR_TEMPLATES_H__</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">// vector overloads</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="cudaMath_8h.html">cudaMath.h</a>&quot;</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">// static assertion</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &lt;type_traits&gt;</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">// get base type (uint8 or float) from vector</span></div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structcudaVectorTypeInfo.html">   43</a></span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt; <span class="keyword">struct </span><a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo</a>;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="structcudaVectorTypeInfo_3_01uchar_01_4.html#a4e32c3e69f5ba56009d8656e89309878">   45</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">struct </span><a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo</a>&lt;<a class="code" href="cudaMath_8h.html#a65f85814a8290f9797005d3b28e7e5fc">uchar</a>&gt;  { <span class="keyword">typedef</span> uint8_t <a class="code" href="structcudaVectorTypeInfo_3_01uchar_01_4.html#a4e32c3e69f5ba56009d8656e89309878">Base</a>; };</div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="structcudaVectorTypeInfo_3_01uchar3_01_4.html#a5ba9535403c14582b3a815a5fd8af4be">   46</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">struct </span><a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo</a>&lt;uchar3&gt; { <span class="keyword">typedef</span> uint8_t <a class="code" href="structcudaVectorTypeInfo_3_01uchar3_01_4.html#a5ba9535403c14582b3a815a5fd8af4be">Base</a>; };</div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structcudaVectorTypeInfo_3_01uchar4_01_4.html#a6ff1d27c0972bd65582876fdbece3a66">   47</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">struct </span><a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo</a>&lt;uchar4&gt; { <span class="keyword">typedef</span> uint8_t <a class="code" href="structcudaVectorTypeInfo_3_01uchar4_01_4.html#a6ff1d27c0972bd65582876fdbece3a66">Base</a>; };</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="structcudaVectorTypeInfo_3_01float_01_4.html#a292ea663803984316b7c05747e4fbb8e">   49</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">struct </span><a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo</a>&lt;float&gt;  { <span class="keyword">typedef</span> <span class="keywordtype">float</span> <a class="code" href="structcudaVectorTypeInfo_3_01float_01_4.html#a292ea663803984316b7c05747e4fbb8e">Base</a>; };</div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="structcudaVectorTypeInfo_3_01float3_01_4.html#a6be5864d38602803baada9f2861aa2ba">   50</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">struct </span><a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo</a>&lt;float3&gt; { <span class="keyword">typedef</span> <span class="keywordtype">float</span> <a class="code" href="structcudaVectorTypeInfo_3_01float3_01_4.html#a6be5864d38602803baada9f2861aa2ba">Base</a>; };</div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="structcudaVectorTypeInfo_3_01float4_01_4.html#a53140777167eb671068d0e15df44f156">   51</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">struct </span><a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo</a>&lt;float4&gt; { <span class="keyword">typedef</span> <span class="keywordtype">float</span> <a class="code" href="structcudaVectorTypeInfo_3_01float4_01_4.html#a53140777167eb671068d0e15df44f156">Base</a>; };</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment">// static compile-time assertion</span></div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="structcuda__assert__false.html">   55</a></span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <span class="keyword">struct </span><a class="code" href="structcuda__assert__false.html">cuda_assert_false</a> : std::false_type { };</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">// make_vec&lt;T&gt; templates</span></div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ad7b90b5d083311b5744ee6cc448a5b33">   59</a></span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> __host__ __device__ T <a class="code" href="cudaVector_8h.html#ad7b90b5d083311b5744ee6cc448a5b33">make_vec</a>( <span class="keyword">typename</span> <a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo&lt;T&gt;::Base</a> x, <span class="keyword">typename</span> <a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo&lt;T&gt;::Base</a> y, <span class="keyword">typename</span> <a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo&lt;T&gt;::Base</a> z, <span class="keyword">typename</span> <a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo&lt;T&gt;::Base</a> w )    { static_assert(<a class="code" href="structcuda__assert__false.html">cuda_assert_false&lt;T&gt;::value</a>, <span class="stringliteral">&quot;invalid vector type - supported types are uchar3, uchar4, float3, float4&quot;</span>);  }</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ab4712d11abcb112ff292c8eb80aefc13">   61</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ <a class="code" href="cudaMath_8h.html#a65f85814a8290f9797005d3b28e7e5fc">uchar</a>  <a class="code" href="cudaVector_8h.html#ad7b90b5d083311b5744ee6cc448a5b33">make_vec</a>( uint8_t x, uint8_t y, uint8_t z, uint8_t w )     { <span class="keywordflow">return</span> x; }</div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a422b90c1c0a4e2ecfa6f3e67ce17117f">   62</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar3 <a class="code" href="cudaVector_8h.html#ad7b90b5d083311b5744ee6cc448a5b33">make_vec</a>( uint8_t x, uint8_t y, uint8_t z, uint8_t w )     { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aa8a7a118682683e8e44f41de6862f6e1">make_uchar3</a>(x,y,z); }</div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ad69772f08dc3dffbeee5715d8ea62d7f">   63</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar4 <a class="code" href="cudaVector_8h.html#ad7b90b5d083311b5744ee6cc448a5b33">make_vec</a>( uint8_t x, uint8_t y, uint8_t z, uint8_t w )     { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#ad2b004654ffbdfc2c808e294f41e5d04">make_uchar4</a>(x,y,z,w); }</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a4edfa6c2ce98b42b9c069067a3ce1dc8">   65</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ <span class="keywordtype">float</span>  <a class="code" href="cudaVector_8h.html#ad7b90b5d083311b5744ee6cc448a5b33">make_vec</a>( <span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y, <span class="keywordtype">float</span> z, <span class="keywordtype">float</span> w )             { <span class="keywordflow">return</span> x; }</div><div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a98f1a45997f39c48a96682f96530f233">   66</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float3 <a class="code" href="cudaVector_8h.html#ad7b90b5d083311b5744ee6cc448a5b33">make_vec</a>( <span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y, <span class="keywordtype">float</span> z, <span class="keywordtype">float</span> w )             { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aff0ce950ea54e88da8eb7226e215646e">make_float3</a>(x,y,z); }</div><div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#aa57b641154352bb28bfc03e03db80521">   67</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float4 <a class="code" href="cudaVector_8h.html#ad7b90b5d083311b5744ee6cc448a5b33">make_vec</a>( <span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y, <span class="keywordtype">float</span> z, <span class="keywordtype">float</span> w )             { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#a5ac86555d5a546106ec01ed56f8d48b4">make_float4</a>(x,y,z,w); }</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment">// cast_vec&lt;T&gt; templates</span></div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">   71</a></span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> __host__ __device__ T <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar3&amp; a )                           { static_assert(<a class="code" href="structcuda__assert__false.html">cuda_assert_false&lt;T&gt;::value</a>, <span class="stringliteral">&quot;invalid vector type - supported types are uchar3, uchar4, float3, float4&quot;</span>);  }</div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ada07c1f63c2db3894bbd250ccffb3254">   72</a></span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> __host__ __device__ T <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar4&amp; a )                           { static_assert(<a class="code" href="structcuda__assert__false.html">cuda_assert_false&lt;T&gt;::value</a>, <span class="stringliteral">&quot;invalid vector type - supported types are uchar3, uchar4, float3, float4&quot;</span>);  }</div><div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a09d6a309051447dee966d21e4b5b836b">   73</a></span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> __host__ __device__ T <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float3&amp; a )                           { static_assert(<a class="code" href="structcuda__assert__false.html">cuda_assert_false&lt;T&gt;::value</a>, <span class="stringliteral">&quot;invalid vector type - supported types are uchar3, uchar4, float3, float4&quot;</span>);  }</div><div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a4964f05457f15b6ad7d173fe2130e0ef">   74</a></span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> __host__ __device__ T <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float4&amp; a )                           { static_assert(<a class="code" href="structcuda__assert__false.html">cuda_assert_false&lt;T&gt;::value</a>, <span class="stringliteral">&quot;invalid vector type - supported types are uchar3, uchar4, float3, float4&quot;</span>);  }</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a8eebc34f6985170697cacda9c9c4aedc">   76</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar3 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar3&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aa8a7a118682683e8e44f41de6862f6e1">make_uchar3</a>(a); }</div><div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#aae713d3d05a75c969f7bd67f67fa58ee">   77</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar4 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar3&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#ad2b004654ffbdfc2c808e294f41e5d04">make_uchar4</a>(a); }</div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a540c06850ab45c29a2447edf85974219">   78</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float3 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar3&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aff0ce950ea54e88da8eb7226e215646e">make_float3</a>(a); }</div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a77303701c086b3b20c069509d33fa5e7">   79</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float4 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar3&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#a5ac86555d5a546106ec01ed56f8d48b4">make_float4</a>(a); }</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ade488f134d17dd5e4840905f9a22ad5f">   81</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar3 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar4&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aa8a7a118682683e8e44f41de6862f6e1">make_uchar3</a>(a); }</div><div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#aa0a881e4cafe36e91585f0689b55da6e">   82</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar4 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar4&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#ad2b004654ffbdfc2c808e294f41e5d04">make_uchar4</a>(a); }</div><div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ad6e4f46bd4a91f513f9fd24964e8ad62">   83</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float3 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar4&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aff0ce950ea54e88da8eb7226e215646e">make_float3</a>(a); }</div><div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a7aa0a5fab2bf7bad86aa16960e06f785">   84</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float4 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> uchar4&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#a5ac86555d5a546106ec01ed56f8d48b4">make_float4</a>(a); }</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a3fa3665596b1338ebf4c9c060692ca5b">   86</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar3 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float3&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aa8a7a118682683e8e44f41de6862f6e1">make_uchar3</a>(a); }</div><div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#adeb8912cab3a2bda15c402ee4d887932">   87</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar4 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float3&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#ad2b004654ffbdfc2c808e294f41e5d04">make_uchar4</a>(a); }</div><div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a21a136c1efefe383edcee8c1bdc710cc">   88</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float3 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float3&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aff0ce950ea54e88da8eb7226e215646e">make_float3</a>(a); }</div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ab3a3af22b8b84e3ed8c34484b07d404c">   89</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float4 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float3&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#a5ac86555d5a546106ec01ed56f8d48b4">make_float4</a>(a); }</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;</div><div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ace9b64d7dd76638aebbb811bf752d00e">   91</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar3 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float4&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aa8a7a118682683e8e44f41de6862f6e1">make_uchar3</a>(a); }</div><div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a5b6ad0c7bee9a84ab633307efa0a3e14">   92</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uchar4 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float4&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#ad2b004654ffbdfc2c808e294f41e5d04">make_uchar4</a>(a); }</div><div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ad1111b8eeb3cd374553ca34e533a98fb">   93</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float3 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float4&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#aff0ce950ea54e88da8eb7226e215646e">make_float3</a>(a); }</div><div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a2d8256dae6a6129b9adaaf91f97e0eda">   94</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ float4 <a class="code" href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a>( <span class="keyword">const</span> float4&amp; a )                                        { <span class="keywordflow">return</span> <a class="code" href="cudaMath_8h.html#a5ac86555d5a546106ec01ed56f8d48b4">make_float4</a>(a); }</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<span class="comment">// extract alpha color component</span></div><div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#aa94774faf063d34dab6f3f374d73ea7a">   98</a></span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> __device__ <span class="keyword">typename</span> <a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo&lt;T&gt;::Base</a> <a class="code" href="cudaVector_8h.html#aa94774faf063d34dab6f3f374d73ea7a">alpha</a>( T vec, <span class="keyword">typename</span> <a class="code" href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo&lt;T&gt;::Base</a> default_alpha=255 )      { static_assert(<a class="code" href="structcuda__assert__false.html">cuda_assert_false&lt;T&gt;::value</a>, <span class="stringliteral">&quot;invalid vector type - supported types are uchar3, uchar4, float3, float4&quot;</span>);  }</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#a86392f5942dbe9a0563c0cc32350e229">  100</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uint8_t <a class="code" href="cudaVector_8h.html#aa94774faf063d34dab6f3f374d73ea7a">alpha</a>( uchar3 vec, uint8_t default_alpha )                { <span class="keywordflow">return</span> default_alpha; }</div><div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ab50272f9412fd83b4f4f67d222b1294f">  101</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ uint8_t <a class="code" href="cudaVector_8h.html#aa94774faf063d34dab6f3f374d73ea7a">alpha</a>( uchar4 vec, uint8_t default_alpha )                { <span class="keywordflow">return</span> vec.w; }</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div><div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ab0ad365ef3a67482822305bca1d9ada2">  103</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ <span class="keywordtype">float</span> <a class="code" href="cudaVector_8h.html#aa94774faf063d34dab6f3f374d73ea7a">alpha</a>( float3 vec, <span class="keywordtype">float</span> default_alpha )                    { <span class="keywordflow">return</span> default_alpha; }</div><div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="cudaVector_8h.html#ac0d98a665e25ffa6d701a2ce2f6efd12">  104</a></span>&#160;<span class="keyword">template</span>&lt;&gt; <span class="keyword">inline</span> __host__ __device__ <span class="keywordtype">float</span> <a class="code" href="cudaVector_8h.html#aa94774faf063d34dab6f3f374d73ea7a">alpha</a>( float4 vec, <span class="keywordtype">float</span> default_alpha )                    { <span class="keywordflow">return</span> vec.w; }</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div><div class="ttc" id="structcudaVectorTypeInfo_3_01uchar3_01_4_html_a5ba9535403c14582b3a815a5fd8af4be"><div class="ttname"><a href="structcudaVectorTypeInfo_3_01uchar3_01_4.html#a5ba9535403c14582b3a815a5fd8af4be">cudaVectorTypeInfo&lt; uchar3 &gt;::Base</a></div><div class="ttdeci">uint8_t Base</div><div class="ttdef"><b>Definition:</b> cudaVector.h:46</div></div>
<div class="ttc" id="structcudaVectorTypeInfo_3_01float_01_4_html_a292ea663803984316b7c05747e4fbb8e"><div class="ttname"><a href="structcudaVectorTypeInfo_3_01float_01_4.html#a292ea663803984316b7c05747e4fbb8e">cudaVectorTypeInfo&lt; float &gt;::Base</a></div><div class="ttdeci">float Base</div><div class="ttdef"><b>Definition:</b> cudaVector.h:49</div></div>
<div class="ttc" id="structcudaVectorTypeInfo_html"><div class="ttname"><a href="structcudaVectorTypeInfo.html">cudaVectorTypeInfo</a></div><div class="ttdef"><b>Definition:</b> cudaVector.h:43</div></div>
<div class="ttc" id="structcudaVectorTypeInfo_3_01float4_01_4_html_a53140777167eb671068d0e15df44f156"><div class="ttname"><a href="structcudaVectorTypeInfo_3_01float4_01_4.html#a53140777167eb671068d0e15df44f156">cudaVectorTypeInfo&lt; float4 &gt;::Base</a></div><div class="ttdeci">float Base</div><div class="ttdef"><b>Definition:</b> cudaVector.h:51</div></div>
<div class="ttc" id="structcudaVectorTypeInfo_3_01float3_01_4_html_a6be5864d38602803baada9f2861aa2ba"><div class="ttname"><a href="structcudaVectorTypeInfo_3_01float3_01_4.html#a6be5864d38602803baada9f2861aa2ba">cudaVectorTypeInfo&lt; float3 &gt;::Base</a></div><div class="ttdeci">float Base</div><div class="ttdef"><b>Definition:</b> cudaVector.h:50</div></div>
<div class="ttc" id="structcudaVectorTypeInfo_3_01uchar_01_4_html_a4e32c3e69f5ba56009d8656e89309878"><div class="ttname"><a href="structcudaVectorTypeInfo_3_01uchar_01_4.html#a4e32c3e69f5ba56009d8656e89309878">cudaVectorTypeInfo&lt; uchar &gt;::Base</a></div><div class="ttdeci">uint8_t Base</div><div class="ttdef"><b>Definition:</b> cudaVector.h:45</div></div>
<div class="ttc" id="cudaMath_8h_html_aff0ce950ea54e88da8eb7226e215646e"><div class="ttname"><a href="cudaMath_8h.html#aff0ce950ea54e88da8eb7226e215646e">make_float3</a></div><div class="ttdeci">__host__ __device__ float3 make_float3(float s)</div><div class="ttdef"><b>Definition:</b> cudaMath.h:128</div></div>
<div class="ttc" id="cudaVector_8h_html_aa94774faf063d34dab6f3f374d73ea7a"><div class="ttname"><a href="cudaVector_8h.html#aa94774faf063d34dab6f3f374d73ea7a">alpha</a></div><div class="ttdeci">__device__ cudaVectorTypeInfo&lt; T &gt;::Base alpha(T vec, typename cudaVectorTypeInfo&lt; T &gt;::Base default_alpha=255)</div><div class="ttdef"><b>Definition:</b> cudaVector.h:98</div></div>
<div class="ttc" id="cudaVector_8h_html_ad7b90b5d083311b5744ee6cc448a5b33"><div class="ttname"><a href="cudaVector_8h.html#ad7b90b5d083311b5744ee6cc448a5b33">make_vec</a></div><div class="ttdeci">__host__ __device__ T make_vec(typename cudaVectorTypeInfo&lt; T &gt;::Base x, typename cudaVectorTypeInfo&lt; T &gt;::Base y, typename cudaVectorTypeInfo&lt; T &gt;::Base z, typename cudaVectorTypeInfo&lt; T &gt;::Base w)</div><div class="ttdef"><b>Definition:</b> cudaVector.h:59</div></div>
<div class="ttc" id="cudaMath_8h_html_ad2b004654ffbdfc2c808e294f41e5d04"><div class="ttname"><a href="cudaMath_8h.html#ad2b004654ffbdfc2c808e294f41e5d04">make_uchar4</a></div><div class="ttdeci">__host__ __device__ uchar4 make_uchar4(uchar s)</div><div class="ttdef"><b>Definition:</b> cudaMath.h:320</div></div>
<div class="ttc" id="structcudaVectorTypeInfo_3_01uchar4_01_4_html_a6ff1d27c0972bd65582876fdbece3a66"><div class="ttname"><a href="structcudaVectorTypeInfo_3_01uchar4_01_4.html#a6ff1d27c0972bd65582876fdbece3a66">cudaVectorTypeInfo&lt; uchar4 &gt;::Base</a></div><div class="ttdeci">uint8_t Base</div><div class="ttdef"><b>Definition:</b> cudaVector.h:47</div></div>
<div class="ttc" id="cudaMath_8h_html_aa8a7a118682683e8e44f41de6862f6e1"><div class="ttname"><a href="cudaMath_8h.html#aa8a7a118682683e8e44f41de6862f6e1">make_uchar3</a></div><div class="ttdeci">__host__ __device__ uchar3 make_uchar3(uchar s)</div><div class="ttdef"><b>Definition:</b> cudaMath.h:207</div></div>
<div class="ttc" id="cudaMath_8h_html"><div class="ttname"><a href="cudaMath_8h.html">cudaMath.h</a></div></div>
<div class="ttc" id="structcuda__assert__false_html"><div class="ttname"><a href="structcuda__assert__false.html">cuda_assert_false</a></div><div class="ttdef"><b>Definition:</b> cudaVector.h:55</div></div>
<div class="ttc" id="cudaMath_8h_html_a5ac86555d5a546106ec01ed56f8d48b4"><div class="ttname"><a href="cudaMath_8h.html#a5ac86555d5a546106ec01ed56f8d48b4">make_float4</a></div><div class="ttdeci">__host__ __device__ float4 make_float4(float s)</div><div class="ttdef"><b>Definition:</b> cudaMath.h:248</div></div>
<div class="ttc" id="cudaMath_8h_html_a65f85814a8290f9797005d3b28e7e5fc"><div class="ttname"><a href="cudaMath_8h.html#a65f85814a8290f9797005d3b28e7e5fc">uchar</a></div><div class="ttdeci">unsigned char uchar</div><div class="ttdef"><b>Definition:</b> cudaMath.h:37</div></div>
<div class="ttc" id="cudaVector_8h_html_a9ce1079a2a17fe53209e0a5de2b91c4f"><div class="ttname"><a href="cudaVector_8h.html#a9ce1079a2a17fe53209e0a5de2b91c4f">cast_vec</a></div><div class="ttdeci">__host__ __device__ T cast_vec(const uchar3 &amp;a)</div><div class="ttdef"><b>Definition:</b> cudaVector.h:71</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_54a0acf6da04fe2ed9410b4c6369bc5d.html">jetson-utils</a></li><li class="navelem"><a class="el" href="cudaVector_8h.html">cudaVector.h</a></li>
    <li class="footer">Generated on Tue Jul 14 2020 21:59:33 for Jetson Inference by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
